package com.baizhi.cmfzdemo.controller;

import com.baizhi.cmfzdemo.entity.CmfzArticle;
import com.baizhi.cmfzdemo.service.LuceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 54433 on 2019/4/16.
 */
@RestController
public class LuceneController {
    @Autowired
    private LuceneService luceneService;


    @RequestMapping("/showByLucene")
    public Map showByLucene(String text,int page,int rows) throws IOException {
        List<CmfzArticle> cmfzArticles = luceneService.queryByKeyword(text);
        Map map = new HashMap();
        map.put("tatol",6);
        map.put("rows",cmfzArticles);
        return map;
    }
}
